home *** CD-ROM | disk | FTP | other *** search
/ Kompuutteri K-CD 2002 #1 / K-CD_2002-01.iso / Delphi / INSTALL / program files / Borland / Delphi6 / Doc / Buttons.int < prev    next >
Encoding:
Text File  |  2001-05-22  |  4.4 KB  |  133 lines

  1.  
  2. {*******************************************************}
  3. {                                                       }
  4. {       Borland Delphi Visual Component Library         }
  5. {                                                       }
  6. {  Copyright (c) 1995-2001 Borland Software Corporation }
  7. {                                                       }
  8. {*******************************************************}
  9.  
  10. unit Buttons;
  11.  
  12. {$S-,W-,R-,H+,X+}
  13. {$C PRELOAD}
  14.  
  15. interface
  16.  
  17. uses Windows, Messages, Classes, Controls, Forms, Graphics, StdCtrls,
  18.   ExtCtrls, CommCtrl;
  19.  
  20. type
  21.   TButtonLayout = (blGlyphLeft, blGlyphRight, blGlyphTop, blGlyphBottom);
  22.   TButtonState = (bsUp, bsDisabled, bsDown, bsExclusive);
  23.   TButtonStyle = (bsAutoDetect, bsWin31, bsNew);
  24.   TNumGlyphs = 1..4;
  25.  
  26.   TSpeedButton = class;
  27.  
  28.   TSpeedButtonActionLink = class(TControlActionLink)
  29.   protected
  30.     FClient: TSpeedButton;
  31.     procedure AssignClient(AClient: TObject); override;
  32.     function IsCheckedLinked: Boolean; override;
  33.     function IsGroupIndexLinked: Boolean; override;
  34.     procedure SetGroupIndex(Value: Integer); override;
  35.     procedure SetChecked(Value: Boolean); override;
  36.   end;
  37.  
  38.   TSpeedButton = class(TGraphicControl)
  39.   protected
  40.     FState: TButtonState;
  41.     procedure ActionChange(Sender: TObject; CheckDefaults: Boolean); override;
  42.     function GetActionLinkClass: TControlActionLinkClass; override;
  43.     function GetPalette: HPALETTE; override;
  44.     procedure Loaded; override;
  45.     procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
  46.       X, Y: Integer); override;
  47.     procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
  48.     procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
  49.       X, Y: Integer); override;
  50.     procedure Paint; override;
  51.     property MouseInControl: Boolean;
  52.   public
  53.     constructor Create(AOwner: TComponent); override;
  54.     destructor Destroy; override;
  55.     procedure Click; override;
  56.   published
  57.     property Action;
  58.     property AllowAllUp: Boolean default False;
  59.     property Anchors;
  60.     property BiDiMode;
  61.     property Constraints;
  62.     property GroupIndex: Integer default 0;
  63.     property Down: Boolean default False;
  64.     property Caption;
  65.     property Enabled;
  66.     property Flat: Boolean default False;
  67.     property Font;
  68.     property Glyph: TBitmap;
  69.     property Layout: TButtonLayout default blGlyphLeft;
  70.     property Margin: Integer default -1;
  71.     property NumGlyphs: TNumGlyphs default 1;
  72.     property ParentFont;
  73.     property ParentShowHint;
  74.     property ParentBiDiMode;
  75.     property PopupMenu;
  76.     property ShowHint;
  77.     property Spacing: Integer default 4;
  78.     property Transparent: Boolean default True;
  79.     property Visible;
  80.     property OnClick;
  81.     property OnDblClick;
  82.     property OnMouseDown;
  83.     property OnMouseMove;
  84.     property OnMouseUp;
  85.   end;
  86.     
  87.   TBitBtnKind = (bkCustom, bkOK, bkCancel, bkHelp, bkYes, bkNo, bkClose,
  88.     bkAbort, bkRetry, bkIgnore, bkAll);
  89.     
  90.   TBitBtn = class(TButton)
  91.   protected
  92.     procedure ActionChange(Sender: TObject; CheckDefaults: Boolean); override;
  93.     procedure CreateHandle; override;
  94.     procedure CreateParams(var Params: TCreateParams); override;
  95.     function GetPalette: HPALETTE; override;
  96.     procedure SetButtonStyle(ADefault: Boolean); override;
  97.   public
  98.     constructor Create(AOwner: TComponent); override;
  99.     destructor Destroy; override;
  100.     procedure Click; override;
  101.   published
  102.     property Action;
  103.     property Anchors;
  104.     property BiDiMode;
  105.     property Cancel stored IsCustom;
  106.     property Caption stored IsCustomCaption;
  107.     property Constraints;
  108.     property Default stored IsCustom;
  109.     property Enabled;
  110.     property Glyph: TBitmap;
  111.     property Kind: TBitBtnKind default bkCustom;
  112.     property Layout: TButtonLayout default blGlyphLeft;
  113.     property Margin: Integer default -1;
  114.     property ModalResult stored IsCustom;
  115.     property NumGlyphs: TNumGlyphs default 1;
  116.     property ParentShowHint;
  117.     property ParentBiDiMode;
  118.     property ShowHint;
  119.     property Style: TButtonStyle default bsAutoDetect;
  120.     property Spacing: Integer default 4;
  121.     property TabOrder;
  122.     property TabStop;
  123.     property Visible;
  124.     property OnEnter;
  125.     property OnExit;
  126.   end;
  127.     
  128. function DrawButtonFace(Canvas: TCanvas; const Client: TRect;
  129.   BevelWidth: Integer; Style: TButtonStyle; IsRounded, IsDown,
  130.   IsFocused: Boolean): TRect;
  131.     
  132. implementation
  133.